<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>最近订单产品列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
</head>
<body>
	<div class="container">
        <div class="flow">
            <div class="itemtitle">
                <h3>最近订单产品管理</h3>
                <ul>
                    <li><a id="activity_button" href="javascript:;"><span>添加产品</span></a></li>
				</ul>
            </div>
        </div>
        <div class="h35"></div>
        
        <form action="" method="get">
	    <input type="hidden" name="m" value="activity">
	    <input type="hidden" name="s" value="<{$smarty.get.s}>">
	    <table>
	        <tbody>
	            <tr>
					<td width="50">产品ID:</td>
            		<td width="100"><textarea name="product_id" style="resize:horizontal;height:30px;"><{$smarty.get.product_id}></textarea></td>
					<td width="80">订单类型:</td>
					<td width="100">
						<select name="order_type">
                            <option value="">---全部---</option>
                            <option value="1" <{if $smarty.get.order_type==1}>selected<{/if}>>普通订单</option>
                            <option value="2" <{if $smarty.get.order_type==2}>selected<{/if}>>伙拼订单</option>
                            <option value="3" <{if $smarty.get.order_type==3}>selected<{/if}>>微仓订单</option>
                        </select>
					</td>
	                <td width="100"><input type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
	            </tr>
	            
	        </tbody>
	    </table>
	    </form>
    
		<script type="text/javascript">
        $(function(){
            /* 全选 */
             $('.checkall').click(function(){
                var _self = this;
                $('.checkitem').each(function(){
                    if (!this.disabled)
                    {
                        $(this).attr('checked', _self.checked);
                    }
                });
                $('.checkall').attr('checked', this.checked);
            });	 
        });
        </script>
        <form action="" method="post">
        <table class="table">
            <tbody>
                <tr class="header partition">
                	<th width="30"></th>
                    <th width="50">显示顺序</th>
                    <th width="50">产品ID</th>
                    <th width="80">产品图片</th>
                    <th width="200">产品名称</th>
                    <th width="70">数量</th>
            		<th width="100">订单类型</th>
            		<th width="100">下单时间</th>
                </tr>
                <{foreach item=list from=$de.list}>
				<tr>
					<td><input type="checkbox" value="<{$list.id}>" class="checkitem" name="chk[]"></td>
                    <td><input type="text" class="w50" name="displayorder[<{$list.id}>]" value="<{$list.displayorder}>" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" onkeyup="value=value.replace(/[^\d]/g,'')"/></td>
                    <td><{$list.pid}></td>
                    <td><a href="<{$list.pic}>" target="_blank"><img width="80" src="<{$list.pic}>/80"></a></td>
                    <td><input type="text" class="w250" id="pname_<{$list.id}>" onblur="savePname(<{$list.id}>);" value="<{$list.product_name}>"/></td>
                    <td><input type="text" id="num_<{$list.id}>" onblur="savePnum(<{$list.id}>);" value="<{$list.num}>"/></td>
                    <td>
                    <{if $list.order_type==2}>
                    	伙拼订单
                    <{elseif $list.order_type==3}>
                    	微仓订单
                    <{else}>
                    	普通订单
                    <{/if}>
                    </td>
                    <td><{$list.order_time}></td>
               </tr>
                <{foreachelse}>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <{/foreach}>
            </tbody>
            <tfoot>
                <tr>
                	<td colspan="4">
                		<input type="checkbox" class="checkall" id="del">
                        <input name="act" type="hidden" value="op">
                        <input name="submit" type="submit" value="提交">
                        <input name="submit" type="submit" onclick="return confirm('确定删除吗');" value="<{$lang.del}>">
                    </td>
                    <td colspan="7"><div class="page"><{$de.page}>共有<{$countpro}>个记录 每页显示<input type="text" style="width:30px;" id="page_size" value="<{$smarty.get.page_size}>">条<input type="button" value="确定" onclick="location.href='?m=activity&s=<{$smarty.get.s}>&page_size='+$('#page_size').val()"></div></td>
                </tr>
            </tfoot>
        </table>
        </form>
    </div>
<script>
//保存名称
function savePname(dataId){
	if(dataId>0){
		var pname = $('#pname_'+dataId).val();
		$.post('<{$config.weburl}>/admin/module.php?m=activity&s=<{$smarty.get.s}>',{"id":dataId,"product_name":pname,"act":"changeName"},function(s){
			window.location.reload();
		});
	}
}
//保存数量
function savePnum(dataId){
	if(dataId>0){
		var num = $('#num_'+dataId).val();
		$.post('<{$config.weburl}>/admin/module.php?m=activity&s=<{$smarty.get.s}>',{"id":dataId,"num":num,"act":"changeNum"},function(s){
			window.location.reload();
		});
	}
}

$('#activity_button').click(function(){
	window.parent.iframe_form("activity", '活动产品管理', 'module.php?m=activity&s=<{$smarty.get.s}>&act=showAdd', 1000, 600);
	return false;
});
</script>    
</body>
</html>